package com.xuecheng.content.feignclient.search;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CourseIndexClientFactory implements FallbackFactory<CourseIndexClient> {
    @Override
    public CourseIndexClient create(Throwable throwable) {
        return new CourseIndexClient() {
            @Override
            public Boolean add(CourseIndex courseIndex) {
                log.error("调用搜索服务查询媒资文件发生熔断：{}",throwable.toString(),throwable);
                return null;
            }
        };
    }
}
